From 366d7afd04f9ec4bd7b6bd561c560ee59fed3ec5 Mon Sep 17 00:00:00 2001 From: Debian Qt/KDE Maintainers Date: Wed, 19 Aug 2020 18:40:32 +0100 Subject: [PATCH] moc: handle include directives in enums Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=98cb33115089eebc Last-Update: 2020-06-29 When including files, moc inserts a MOC_INCLUDE_BEGIN and MOC_INCLUDE_END token into the token stream. Those are already handled in the toplevel Moc::parse function, but parseEnum lacked support so far. Gbp-Pq: Name moc_handle_includes.diff --- src/tools/moc/moc.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 50946443b..51c468ea7 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -280,11 +280,21 @@ bool Moc::parseEnum(EnumDef *def) } if (!test(LBRACE)) return false; + auto handleInclude = [this]() { + if (test(MOC_INCLUDE_BEGIN)) + currentFilenames.push(symbol().unquotedLexem()); + if (test(NOTOKEN)) { + next(MOC_INCLUDE_END); + currentFilenames.pop(); + } + }; do { if (lookup() == RBRACE) // accept trailing comma break; + handleInclude(); next(IDENTIFIER); def->values += lexem(); + handleInclude(); skipCxxAttributes(); } while (test(EQ) ? until(COMMA) : test(COMMA)); next(RBRACE); -- 2.30.2